from typing import Annotated, List, Optional, Literal

from langchain_core.messages import BaseMessage
from langgraph.graph import add_messages
from pydantic import BaseModel, Field


class FlightServiceState(BaseModel):
    input: str = Field(description="用户输入的原始文本")

    passenger_id: str = Field(description="当前访问的用户Id")

    # 消息会话历史
    messages: Annotated[List[BaseMessage], add_messages] = Field(description="Messages sent by customer service")

    # 当前意图
    current_intent: Literal[
                        "chat",  # 闲聊
                        "flight_query",  # 查询航班信息
                        "faq",  # 回答常见问题
                        "shop_recommend",  # 店铺推荐
                        "transport_plan",  # 交通规划
                        "__end__"  # 结束对话
                    ] | None

    error_message: Optional[str] = Field(
        default=None, description="流程中发生的错误信息"
    )

    human_approval_needed: Optional[bool] = Field(
        default=False, description="是否需要人工批准"
    )

    human_handoff_requested: Optional[bool] = Field(
        default=False, description="是否需要转接人工"
    )
